
<?php Yii::app()->clientScript->registerScript('taxcodenex',<<<HERE
        Ext.onReady(function(){
        var store=Ext.create('Ext.data.Store',{
            model:'TaxcodeNex',
            pageSize:20,
            autoLoad:true,
            proxy:{
                type:'ajax',
                url:'index.php?r=taxcodeNex/list',
                reader:{
                    type:'json',
                    root:'data',
                    totalProperty:'totalCount'
                }
            }
        })
        Ext.create('Ext.ux.LiveSearchGridPanel',{
            store:store,
            height: 450,
            width: grid_width,
            title: 'Nex Taxcode List',
            renderTo: 'taxcodenex-list',
            viewConfig: {
                stripeRows: true
            },
	        plugins: [
		       Ext.create('Ext.grid.plugin.RowEditing', {
   		   	     clicksToEdit: 1,
   		   	     errorSummary:false,
   		   	     listeners: {
   		   	         edit: function(e)
   		   	         {
                        $.ajax({
                            url:'index.php?r=taxcodeNex/update&id='+e.record.data.id,
                            data:{
                                "TaxcodeNex[active]":e.record.data.active,
                                "TaxcodeNex[state]":e.record.data.state,
                            },
                            async:false,
                            type:'post',
                            success:function(data){
								console.log("save done");
								e.record.commit();
                            }
                        });
	
   	    	        }
   	    	    }
   	    	})],          
            bbar: new Ext.PagingToolbar({
                pageSize: 20,
                store:store,
                displayInfo: true,
                displayMsg: 'Displaying topics {0} - {1} of {2}',
                emptyMsg: 'No topics to display'

            }),
            columns:[
                {
                    text:'State',
                    flex:1,
                    dataIndex:'state',
					editor : {
						xtype : "textfield",
						allowBlank : false,	
						maxLength : 2,
					},
                    renderer :  function (value, p, record){
                          return Ext.String.format('<a href="index.php?r=taxcodeNex/update&id={0}">{1}</a>',record.data.id,record.data.state);
                        }                    
                },
                {
                    text:'Status',
                    flex:1,
					editor : {
						xtype : "combobox",
						store : Ext.create('Ext.data.Store',{
								storeId : 'nexTaxCodeStatus',
								data : [
										{'value' : '1', 'text' : 'Active'},
										{'value' : '0', 'text' : 'Not Active'},
									],
								fields : ['value', 'text'],
							}),
						valueField : 'value',
						displayField : 'text',
						editable : false,
					},
                    dataIndex:'active',
					renderer : function (value, p, record) {
						if(value == 0) {
							return "Not Active";
						} else {
							return "Active";
						}
					}
                },
                /*{
                    text:'Actions',
                    flex:1,
                    renderer:function(value,p,record){
                        return Ext.String.format('<a href="index.php?r=taxcodeNex/update&id={0}"><img src="images/update.png"/></a><a href="index.php?r=taxcodeNex/delete&id={0}"><img src="images/delete.png"/></a>',record.data.id);
                    }
                }*/
            ]

        });
    });
HERE
        ,CClientScript::POS_BEGIN);?>


<div id="left-col">
    <?php $this->renderPartial('_side',array(
//        'terms'=>$employee
    ));?>
</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">

            
            <div id="breadcrumb" style="display:none;"><span style="padding-left:10px;font-size:10px;color:#777777;" id="alsoviewing"></span></div>
            <div class="inside">
             
                 <br/>
                 
             
                <div id="taxcodenex-list"></div>


                
            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
    <?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->
